All Questions
16 questions
0votes
0answers
36views
How to properly format the command argument for sudo? [duplicate]
I have a command that is similar to this minimal example: $ sh -c 'echo "1=$1"' _ foo 1=foo $ When I want to run it through sudo, it stops working: $ sudo -i -u user -- sh -c 'echo "1=...
0votes
0answers
362views
Monitoring file change sequenes with Inotifywait
Currently I am monitoring the files by using above code, it works as expected. Basically I am monitoring the opened text files and executing commands. inotifywait -m -q /home/TestDirectory | while ...
1vote
1answer
5kviews
Find row containing string, then return that row and all following rows of text file with awk
Apologies for any duplication, but most questions I've come across relate to getting a specific value from a field in a row, or using tail to get n tailing lines from a file, where n is known a priori....
0votes
1answer
89views
How can I display the largest common part of two files?
I know how to use comm, diff or grep to display every common line of two files. But how can I display only the largest common part, i. e. the most common lines in succession? (If there are equally ...
-1votes
1answer
93views
how to add additional command-line usage scenarios to script?
how can one make this script work with both input usage scenarios below? #1 ./script.sh #2 ./script.sh input.file contents of script.sh for i in *.mp4; do ffmpeg -i "$i" "${i%.*}.mp4 scenario ...
0votes
2answers
218views
Concatenate the Content of Files from Various Directories with a Blank Line in Between
I have the file dir1.txt that contains the names of the following directories: 2 3 4 Directory 2 contains files 2_1.txt and 2_2.txt Directory 3 contains files 3_1.txt and 3_2.txt Directory 4 contains ...
2votes
1answer
615views
How to modify these bash functions into one?
Normally these would go in one's .bashrc file to be used as a stopwatch, but they are sort of inconvienent to use and recall with the several different commands for the different units of time. ...
0votes
3answers
12kviews
Pass arguments from previous commands (pipes) to awk/printf function and format output
I'm trying to filter the most used commands and print that out in a certain way. So far, I've managed to put the desired "filters": $ history | tr -s ' ' | cut -d ' ' -f3 | sort | uniq -c | sort -n | ...
1vote
1answer
1kviews
Opening an application and inputting a command in one line
I have developed an application in C that is a command line. The app has special keywords to output information. Currently I need to run a command to log into my application, than run a command to get ...
1vote
1answer
1kviews
How to create a short cut for the app to my desktop, instead of using terminal?
How do I access the game file in program files (x86) in script editor to create the shortcut? I enter this cmd in the terminal: cd ~/.wine/drive_c/Program\ Files\ \(x86\)/ubisoft/prince\ of\ persia/...
1vote
1answer
3kviews
How to pass Command to program open in shell?
I am writing a shell script to auto-deploy a program with Jboss-cli, in linux ubuntu. I need to open the jboss cli interface and execute some commands but I want to do this automatically. what it ...
20votes
4answers
3kviews
How can I implement a circular flow of data among interconnected commands?
I know of two types how commands can be connected with each other: by using a Pipe (putting std-output into std-input of the next command). by using a Tee (splice the output into many outputs). ...
10votes
4answers
33kviews
Print a string including single quotes and other special characters
How can I write this with an AIX script correctly? My requirement is to write this command in test.txt: clock=$(prtconf -s | awk '{print $4,$5}') I tried this command: print 'clock=$(prtconf -s | ...
0votes
3answers
2kviews
How to compact a chmod UNIX command
Is there anyway to compact the follow UNIX command: chmod 755 scriptA.ksh | chmod 755 scriptB.ksh | chmod 755 scriptC.ksh | chmod 755 scriptD.ksh The above command makes every KornShell (ksh) script ...
20votes
6answers
16kviews
Rerunning the same command with a different parameter
I know that I can run the following command ls Some{File,Folder} And it is equivalent to running this: ls SomeFile SomeFolder (I also use it a lot for things like mv place_{a,b}) However, I was ...